
var express = require('express');
const HistoryModel = require('../HistorySchema')
var router = express.Router();
// 创建 get 接口
router.get('/', function (req, res, next) {
  var data = {
    code: 200,
    data:[
      {
        title:1111,content:'这是1111111111111111',startTime:'2023/05/30',endTime:'2023/05/31'
      },
      {
        title:2222,content:'这是2222222222222222',startTime:'2023/05/30',endTime:'2023/05/31'
      },
      {
        title:333,content:'这是33333333333333333',startTime:'2023/05/30',endTime:'2023/05/31'
      }
    ],
    isSuccess: true,
    msg: "请求成功"
  }
  res.json(data);
});
// 查找
router.get('/getOrfing',(req, res) => {
  if(req.query){
    delete req.query.page
    delete req.query.limit
  }
  HistoryModel.find(req.query,function (err,result){
      if(err){
          res.json({
              code:1001,
              msg:'查找数据失败'
          })
      }else{
          res.json({
              code:200,
              msg:'查找数据成功',
              data:result
          })
      }
  })
})
module.exports = router;
